from shuogg import paramiko_pack_module as PM

redis_start_cmdlist = ['cd /home/redis-3.2.1','./src/redis-server redis.conf']
redis_stop_cmdlist = ['cd /home/redis-3.2.1','./src/redis-server stop']

tomcat_start_cmdlist =[
'export JAVA_HOME=/usr/java/jdk/jdk1.8.0_144',
'export JRE_HOME=/usr/java/jdk/jdk1.8.0_144/jre',
'/usr/java/tomcat/apache-tomcat-8.5.20/bin/startup.sh',
]

tomcat_shutdown_cmdlist =[
'export JAVA_HOME=/usr/java/jdk/jdk1.8.0_144',
'export JRE_HOME=/usr/java/jdk/jdk1.8.0_144/jre',
'/usr/java/tomcat/apache-tomcat-8.5.20/bin/shutdown.sh',
]


TOMCAT_START = PM.list_to_cmd(tomcat_start_cmdlist)
TOMCAT_STOP = PM.list_to_cmd(tomcat_shutdown_cmdlist)
REDIS_START = PM.list_to_cmd(redis_start_cmdlist)
REDIS_STOP = PM.list_to_cmd(redis_stop_cmdlist)
REDIS_PS = 'ps aux|grep redis'

PM.exec_onecmd('39.108.226.252', 'root', '123qwert/', TOMCAT_START)
# PM.exec_onecmd('39.108.226.252', 'root', '123qwert/', TOMCAT_STOP)
# PM.exec_onecmd('39.108.226.252', 'root', '123qwert/', REDIS_START)
# PM.exec_onecmd('39.108.226.252', 'root', '123qwert/', REDIS_STOP)
# PM.exec_onecmd('39.108.226.252', 'root', '123qwert/', 'ps aux|grep redis')



